package com.itheima_04;

//  比较整数相同：使用方法重载思想，设计比较两个整数是否相同的方法，
//  兼容全整数类型（byte，short，int，long）
public class IsSame {
    public static void main(String[] args) {
        long num1 = 10, num2 = 20;
        System.out.println("long\t" + num1 + "\t" + num2 + "\t" + compare(num1, num2));
        short num3 = 5, num4 = 5;
        System.out.println("short\t" + num3 + "\t" + num4 + "\t" + compare(num3, num4));
        byte num5 = 8, num6 = 9;
        System.out.println("byte\t" + num5 + "\t" + num6 + "\t" + compare(num5, num6));
        int num7 = 1, num8 = 1;
        System.out.println("int\t\t" + num7 + "\t" + num8 + "\t" + compare(num7, num8));
    }

    private static boolean compare(long num1, long num2) {
        return (num1 == num2);
    }

    private static boolean compare(short num1, short num2) {
        return (num1 == num2);
    }

    private static boolean compare(byte num1, byte num2) {
        return (num1 == num2);
    }

    private static boolean compare(int num1, int num2) {
        return (num1 == num2);
    }
}
